package util;
import java.math.BigDecimal;
import java.util.Scanner;

/**
 * @classname:InputUtil
 * @description:
 * @author: Lisa
 * @date: 2020/12/9 11:10
 * @version: 0.1
 * @since:1.8
 */
public class InputUtil {
    private InputUtil() {
    }

    private static Scanner input;

    static {
        input = new Scanner(System.in);
    }

    //提供2个静态的方法
    public static int inputInt() {
        return input.nextInt();
    }

    public static float inputFloat(){ return input.nextFloat();}
    public static double inputDouble(){ return input.nextDouble();}
    public static BigDecimal inputBigDecimal (){ return input.nextBigDecimal();}


    public static int inputInt(String regex, String msg) {
        while (true) {
            String str = input.next();
            if (str.matches(regex)) {
                return Integer.parseInt(str);
            }
            System.out.println(msg);
        }
    }

    public static String inputStr() {
        input.nextLine();
        return input.nextLine();
    }
    public static String inputNextStr() {
        return input.next();
    }

}
